package com.master.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.master.dao.SchoolDao;
import com.master.entity.User;

/**
 * Servlet implementation class Update
 */
@WebServlet("/UpdateServlet")
public class UpdateServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String name= request.getParameter("number");
		String psw = request.getParameter("password");
		
		User u = new User();
		User oldUser = (User)request.getSession().getAttribute("curUser");
		u.setAID(oldUser.getAID());
		u.setLOGIN_ID(name);
		u.setLOGIN_PSW(psw);
		
		
		SchoolDao sd = new SchoolDao();
		sd.UpdateAdmin(u);
		response.sendRedirect("TeacherServlet");
	
	}

}
